package com.zy.controller;

import com.zy.annotation.Autowired;
import com.zy.annotation.Controller;
import com.zy.annotation.RequestMapping;
import com.zy.service.TestService;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@Controller("/hello")
public class TestController {
        @Autowired
        private TestService testService;

        @RequestMapping("/login")
        public void login(HttpServletRequest request, HttpServletResponse response) throws IOException {
                request.setCharacterEncoding("utf-8");
                response.setContentType("text/html;charset=utf-8");
                String userName = request.getParameter("userName");
                testService.show(userName);
                response.getWriter().write("欢迎"+userName);
        }
}
